<template>
  <div class="setPassword">
    <ReturnBack></ReturnBack>
    <van-form validate-first @failed="onFailed">
  <van-field
    v-model="value1"
    name="pattern"
    label="手机号码"
    placeholder="请输入电话号码"
    :rules="[{ pattern, message: '请输入正确内容' }]"
  />
  <Verification></Verification>
    <van-field
      v-model="password"
      type="password"
      name="密码"
      label="新密码"
      placeholder="请输入密码"
    />
    <van-field
      v-model="password2"
      type="password"
      name="密码"
      label="确认密码"
      placeholder="请再次输入密码"
    />
    <div class="tishi" v-show=list.isActive>{{list.msg}}</div>
  <div style="margin:20px">
      <van-button round block type="info" native-type="submit" style="background-color:red;border:none; border-radius: 0" @click="onSubmit">保存</van-button>
  </div>
</van-form>
  </div>
</template>

<script>
import Verification from '@/components/verification.vue'
import ReturnBack from '@/components/return.vue'
export default {
  name: 'SetPassword',
  data () {
    return {
      password: null,
      password2: null,
      // eslint-disable-next-line quotes
      list: { msg: "两次密码输入不一致", isActive: false },
      value1: '',
      pattern: /^1[3456789]\d{9}$/
    }
  },
  mounted () {
  },
  methods: {
    validator (val) {
      console.log(/1\d{10}/.test(val))
      // return /1\d{10}/.test(val)
    },
    onFailed (errorInfo) {
      console.log('failed', errorInfo)
    },
    onSubmit () {}
  },
  components: {
    ReturnBack,
    Verification
  }
}
</script>

<style>

</style>
